<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="main/_fragments :: header(~{::title},~{},~{::meta})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>博客评论通知页面</title>
</head>
<body>

<!--头部导航-->
<div th:replace="main/_backEnd :: header_backEnd(0)"></div>

<!--中间内容   ctrl+enter先输入内容然后注释-->
<!--div +tab 快速补全代码-->
<div id="middle-content" class="m-container-small m-padded-tb-big">
    <div class="container">
        <!--表格列表-->
        <table class="ui single line table">
            <thead>
            <tr class="center aligned">
                <th>Id</th>
                <th>创建人</th>
                <th>类型</th>
                <th>文章标题</th>
                <th>状态</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody th:each="list,itstr : ${noticeBeans}">
            <tr class="center aligned">
                <td th:text="${itstr.count}"></td>
                <td th:text="${list.notifier.nickName}"></td>
                <td th:text="${list.messageType == 1}?'评论':(${list.messageType == 2}?'点赞':'反对')"></td>
                <td><a th:href="@{/blog/{id}#command-container(id=${list.blogBean.id})}" target="_blank"
                       th:text="${list.blogBean.title}"></a></td>
                <td>
                    <button class="ui primary button" th:unless="${list.status == 0}">
                        已读
                    </button>
                    <button class="ui red button" th:if="${list.status == 0}">
                        未读
                    </button>
                </td>
                <td th:text="${#dates.format(list.createTime,'yyyy-MM-dd HH:mm')}"></td>
                <td>
                    <a th:unless="${list.status == 1}" href="#" th:href="@{/admin/notice/}+${list.id}"
                       class="ui mini teal basic button">已读</a>
                    <a href="#" th:id="'btnDel'+${list.id}" th:attr="data-url=@{/admin/notice/}+${list.id}"
                       onclick="deleteBtn(this)" class="ui mini red basic button">删除</a>
                    <form id="deleteFormId" method="post">
                        <input type="hidden" name="_method" value="delete">
                    </form>
                </td>
            </tr>
            </tbody>
            <tfoot>
            <tr>
                <th colspan="8">
                    <div class="ui right floated pagination menu" th:if="${noticeBeans.totalPages>1}">
                        <a th:unless="${noticeBeans.first}" class="icon item"
                           th:href="@{/admin/notice(page=${noticeBeans.number}-1)}">
                            <i class="left chevron icon"></i>
                        </a>
                        <a th:unless="${noticeBeans.last}" class="icon item"
                           th:href="@{/admin/notice(page=${noticeBeans.number}+1)}">
                            <i class="right chevron icon"></i>
                        </a>
                    </div>
                </th>
            </tr>
            </tfoot>
        </table>
    </div>
</div>

<div th:replace="main/_fragments :: toTop"></div>
<!--尾部-->
<footer th:replace="main/_fragments :: footer"></footer>


<!--引入js-->
<th:block th:replace="main/_fragments :: script"></th:block>

<script>

    $('.ui.dropdown').dropdown();


    function deleteBtn(obj) {
        $("#deleteFormId").attr("action", $(obj).data("url")).submit();
    }


</script>
</body>
</html>